//
//  SEGQRCodeGeneratorViewController.m
//  ExcellentHome
//
//  Created by liangxinqiang on 15-1-15.
//  Copyright (c) 2015年 陈区. All rights reserved.
//

#import "SEGQRCodeGeneratorViewController.h"

#if __has_include(<Commom/SEGCreateQRCode.h>)
#import <Commom/SEGCreateQRCode.h>
#else
#import "SEGCreateQRCode.h"
#endif

@interface SEGQRCodeGeneratorViewController ()

@end

@implementation SEGQRCodeGeneratorViewController
@synthesize code;
-(void)loadView {
    UIScreen * scr = [UIScreen mainScreen];
    CGRect appbounds = CGRectMake(0,0, scr.bounds.size.width, scr.bounds.size.height-kNavigationBarAndStatusBarHeight);
    UIView *mainView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, appbounds.size.width , appbounds.size.height)];
    
    UIImageView *myShare=[[UIImageView alloc] init];
    myShare.image=[UIImage imageWithContentsOfFile:SEGPicName(@"my_share_bg")];
    myShare.frame=CGRectMake((CGRectGetWidth(mainView.frame) - myShare.image.size.width) / 2.0, 40, myShare.image.size.width, myShare.image.size.height);
    [mainView addSubview:myShare];
    
    
    UILabel * title = [[UILabel alloc] initWithFrame:CGRectMake(0, 19, CGRectGetWidth(myShare.frame), 18)];
    title.font = [UIFont systemFontOfSize:FONT_DESCRIPTION_SIZE];
    title.textColor = kColor_2;
    title.backgroundColor = [UIColor clearColor];
    title.textAlignment = NSTextAlignmentCenter;
    title.text = @"给物业扫一扫查询快递信息";
    [myShare addSubview:title];
    
    UIImageView *line=[[UIImageView alloc] initWithFrame:CGRectMake(10, 55, CGRectGetWidth(myShare.frame) - 20, 0.5)];
    line.image=[UIImage imageWithContentsOfFile:SEGPicName(@"line_500.png")];
    [myShare addSubview:line];
    
    
    erWeiMa = [[UIImageView alloc] initWithFrame:CGRectMake((CGRectGetWidth(myShare.frame) - 160) / 2.0, 75, 160, 160)];
    erWeiMa.image=[UIImage imageWithContentsOfFile:SEGPicName(@"pic_default_300_300")];
    [myShare addSubview:erWeiMa];
    
    self.view = mainView;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"快递二维码";
    [self showCustomNavigationBackButton];
    erWeiMa.image = [SEGCreateQRCode createQRForString:self.code size:erWeiMa.bounds.size.width];
}

- (void)receiveCode:(NSString *)qrCodeStr {
    self.code = qrCodeStr;
}

@end
